﻿<script type="text/javascript">
    //树
    var zNodes_Permission_Log_SelectModule = [];

    var zTree1_Permission_Log_SelectModule;
    var setting_Permission_Log_SelectModule;

    setting_Permission_Log_SelectModule = {
        checkable: false,
        async: true,
        isSimpleData: true,
        asyncUrl: "/Permission/Log/SelectSingleModule",  //获取节点数据的URL地址
        //asyncDataFilter: ajaxDataFilter,
        nameCol: "FullName",
        open: false,
        treeNodeKey: "Id",
        treeNodeParentKey: "ParentId",
        callback: {
            //             beforeAsync: zTreeBeforeAsync,
            asyncSuccess: zTreeOnAsyncSuccess_Permission_Log_SelectModule,
            //             asyncError: zTreeOnAsyncError,
            click: zTreeOnClick_Permission_Log_SelectModule
        }
    };

    function zTreeOnAsyncSuccess_Permission_Log_SelectModule(event, treeId, treeNode, msg) {
        //异步成功
    }

    //树的单击事件
    function zTreeOnClick_Permission_Log_SelectModule(event, treeId, treeNode) {
        if ("@ViewBag.Flag" == "1") {
            $("#moduleId_QueryModule").val(treeNode.Code);
            $("#txtModuleName_QueryModule").val(treeNode.FullName);
        } else if ("@ViewBag.Flag" == "2") {
            $("#moduleId_QueryDate").val(treeNode.Code);
            $("#txtModuleName_QueryDate").val(treeNode.FullName);
        }
    }

    $(document).ready(function () {
        refreshTree_Permission_Log_SelectModule("/Permission/Log/SelectSingleModule");

    });
    function refreshTree_Permission_Log_SelectModule(asyncUrl) {
        $("#getUrl").html("");
        $("#onAsyncSuccessNode").html("<br/>");
        $("#onAsyncErrorNode").html("<br/>");
        setting_Permission_Log_SelectModule.asyncUrl = asyncUrl;
        if ((typeof asyncUrl) == "function") {
            $("#asyncUrlCode").html("setAsyncUrl");
        } else {
            $("#asyncUrlCode").html("\"" + asyncUrl + "\"");
        }
        zTree1_Permission_Log_SelectModule = $("#tree_Permission_Log_SelectModule").zTree(setting_Permission_Log_SelectModule, zNodes_Permission_Log_SelectModule);
    }
    $("#btnSave_Permission_Log_SelectModule").click(function () {
        $.pdialog.closeCurrent();
    });
</script>
<div class="pageContent" layouth="58">
    <ul id="tree_Permission_Log_SelectModule" class="ztree">
    </ul>
</div>
<div class='formBar'>
    <ul>
        <li>
            <button type="button" class="btn btn-success btn-sm" id="btnSave_Permission_Log_SelectModule">
                保存</button>
        </li>
        <li>
            <button type="button" class="close btn btn-default btn-sm">
                取消</button>
        </li>
    </ul>
</div>
